<html lang="zh" xmlns:th="http://www.thymeleaf.org">
	<head>
		<link rel="stylesheet" href="https://www.layuicdn.com/layui/css/layui.css">
		<script src="https://www.layuicdn.com/layui-v2.5.6/layui.js"></script>
		<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
	</head>
	<body>
		<div class="layui-col-xs10 layui-col-xs-offset1" style="margin-top: 20px;">
			<div class="layui-form">
				<div class="layui-col-xs12" style="height: 450px;overflow: auto;">
				  <table class="layui-table">
				    <colgroup>
				      <col width="100">
				      <col width="200">
				      <col width="400">
				      <col>
				    </colgroup>
				    <thead>
				      <tr>
				        <th>编号</th>
				        <th>课程名称</th>
				        <th>学生名称</th>
				        <th>操作</th>
				      </tr> 
				    </thead>
				    <tbody>
				      <tr th:each="answer,status : ${answers}">
				        <td th:text="${status.count}"></td>
				        <td><a th:href="@{'info/' + ${answer.courseId}}" th:text="${answer.courseName}"></a></td>
				        <td><a href="javascript:;" th:onclick="student[[${answer.studentUsername}]]" th:text="${answer.studentName}"></a></td>
				        <td>
				        	<button class="layui-btn" th:onclick="window.location.href = 'paper/check?id=[[${answer.id}]]&paperId=[[${answer.paperId}]]'">批改试卷</button>
				        	<!--<button class="layui-btn layui-btn-warm" th:onclick="window.open('paper/answer?id=[[${answer.id}]]&paperId=[[${answer.paperId}]]', '_blank')">生成试卷</button>-->
				        </td>
				      </tr>
				    </tbody>
				  </table>
			  	</div>
			  	<!-- 分页 -->
				<div class="layui-col-xs4 layui-col-xs-offset4">
					<button th:onclick="window.location.href = 'course?page=[[${page-1}]]&limit=9'" type="button" class="layui-btn" th:disabled="${page > 1} ? '' : 'disabled'" th:classappend="${page > 1} ? '' : 'layui-btn-disabled'">上一页</button>
						<span th:text="${page}"></span>
						<button th:onclick="window.location.href = 'course?page=[[${page+1}]]&limit=9'" type="button" class="layui-btn" th:disabled="${page < count} ? '' : 'disabled'" th:classappend="${page < count} ? '' : 'layui-btn-disabled'">下一页</button>
				</div>
			</div>
		</div>
	</body>
	<script type="text/javascript">
		function student(username){
			layui.use('layer', function(){
				var layer = layui.layer;
				var info = layer.open({
				      type: 2,
				      title: '学生信息',
				      shadeClose: true,
				      shade: false,
				      offset: 't', 
				      maxmin: true, //开启最大化最小化按钮
				      area: ['600px', '400px'],
				      content: 'student/info?username='+username
				}); 
			})
		}
	</script>
</html>